function setPosition(obj, _x, _y)
	obj.x = _x
	obj.y = _y
end

function move(x, y, angle, speed)

	tempx = x + (math.cos(angle) * speed)
	tempy = y + (math.sin(angle) * speed)
	return tempx,tempy
end

function calculateAngle(x1, y1, x2, y2)
	
	--temp = math.atan( ( ((v.path[1].y - v.y)) / (v.path[1].x - v.x)) )
	temp = math.atan(  (y2 - y1) / (x2 - x1) ) 

	if x2 < x1 then
		temp = temp + math.pi
	end

	return temp
end

--takes objects and uses their x,y instead of just taking in an x and y. this helps readability
function calculateAngleObj(a,b)
	
	if a == nil or b == nil then
		return -1
	end
	
	--temp = math.atan( ( ((v.path[1].y - v.y)) / (v.path[1].x - v.x)) )
	temp = math.atan(  (b.y - a.y) / (b.x - a.x) ) 

	if b.x < a.x then
		temp = temp + math.pi
	end

	return temp
end

function getDistance(x1, y1, x2, y2)
	return math.sqrt( ((x2-x1)^2) + ((y2-y1)^2) )
end

--takes objects and uses their x,y instead of just taking in an x and y. this helps readability
function getDistanceObj(a,b)
	if a == nil or b == nil then
		return -1
	end

	return math.sqrt( ((b.x-a.x)^2) + ((b.y-a.y)^2) )
end

function squareCollisionObj(obj,sqr,r)
	--if r == nil then
		if obj.x > sqr.x and obj.x < sqr.x2 and obj.y > sqr.y and obj.y < sqr.y2 then
			return true
		else
			return false
		end	
	--end
end

function squareCollision(x,y,sqr,r)
	if sqr == nil or sqr.type ~= 'square' then
		return false
	end

	--if r == nil then
		if x > sqr.x and x < sqr.x2 and y > sqr.y and y < sqr.y2 then
			return true
		--else
		--	return false
		end	
	--else
		if math.abs(x-sqr.x) < r or math.abs(y-sqr.y) < r or math.abs(x-sqr.x2) < r or math.abs(y-sqr.y2) < r then
			return true
		else
			return false
		end	
	--end
	
	sqr = {}
end